const cloud = require('wx-server-sdk')

// 初始化 cloud
cloud.init({
  env: 'cloud1-1gijto24e717d2dd',
})

exports.main = async (event, context) => {
  console.log(event)
  console.log(context)
  const wxContext = cloud.getWXContext()
  const db = cloud.database()
  console.log(wxContext.OPENID)
  return await db.collection('users').where({
    _openid: wxContext.OPENID
  }).get()
  

}

